package cn.topevery.garden.dal.dao.impl;

import cn.topevery.garden.dal.dao.DeviceObjectRelateLogDao;
import cn.topevery.garden.entity.po.DeviceObjectRelateLog;
import cn.topevery.garden.entity.query.DeviceObjectRelateLogQuery;
import cn.topevery.garden.framework.base.BaseDaoImpl;
import hw.topevery.framework.db.entity.DataPager;
import hw.topevery.framework.db.entity.SqlQueryMate;
import hw.topevery.framework.db.enums.ScriptConditionEnum;
import hw.topevery.framework.entity.DbCsp;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 
 *
 * @author code-generate
 * @date 2021-09-08
 */
@Repository
public class DeviceObjectRelateLogDaoImpl extends BaseDaoImpl<DeviceObjectRelateLog> implements DeviceObjectRelateLogDao {
    @Override
    public <P extends DbCsp> List<DeviceObjectRelateLog> getSearch(P para) {
        return null;
    }

    

    @Override
    public DataPager<DeviceObjectRelateLog> listPage(DeviceObjectRelateLogQuery query) {
        String table = "t_device_object_relate_log tdorl";

        String columns = "tdorl.*";

        int pageIndex = query.pageIndex - 1;
        int pageSize = query.pageSize;

        SqlQueryMate sqlQueryMate = new SqlQueryMate(table).setColumns(columns).setOrderBy("tdorl.c_id desc");
        sqlQueryMate
                .where(true, "tdorl.c_db_status", ScriptConditionEnum.Eq, 0)
        ;

        return getDataPager(sqlQueryMate, pageSize, pageIndex, DeviceObjectRelateLog.class);
    }
}
